package 树;

import binary_tree.TreeNode;

/**
 * @author macy
 * @date 2025/11/10 16:18
 */
public class MaxDepth {

    public static void main(String[] args) {


    }


    public int maxDepth(TreeNode root) {
        if(root==null){
            return 0;
        }
        int left=maxDepth(root.left);
        int right=maxDepth(root.right);
        return Math.max(left,right)+1;
    }
}
